'use strict';

var Router = require('koa-router');
var koaRouter = new Router({
    //prefix: '/api'
});

function router(routeConfig) {
    return function (target, key, descriptor) {
        koaRouter[routeConfig.method](routeConfig.route, function (ctx, next) {
            return new Promise(function (resolve, reject) {
                ctx.body = descriptor.value();
                resolve(descriptor.value());
            });
        });
    };
}